import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import 'element-plus/dist/index.css'
import './assets/styles/main.css'
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/SvgIcon/index.vue'
import * as xlsx from 'xlsx'
import hljs from 'highlight.js'
import 'highlight.js/styles/vs2015.css'

export const app = createApp(App)
app.use(router)
app.component('SvgIcon', SvgIcon)
app.config.globalProperties.$xlsx = xlsx

//创建v-highlight全局指令
app.directive('highlight', function (el: HTMLElement) {
  const blocks = el.querySelectorAll<HTMLElement>('pre code')
  blocks.forEach((block) => {
    hljs.highlightElement(block)
  })
})

app.mount('#app')
